]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
quickSettings: Consider menu width when calculating its preferred height
authorSebastian Keller <skeller@gnome.org>
Tue, 17 Mar 2026 03:21:09 +0000 (04:21 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 24 Mar 2026 20:59:43 +0000 (20:59 +0000)
Previously the width of a menu was ignored when calculating its
preferred height. This was leading to line wrapped text never being
wrapped in these calculations and thus the menu being assumed to be
shorter than it actually ends up when allocated with line wrapping.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6952
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4136>

js/ui/quickSettings.js

index 8a055e56b91782c49e296189df32d40bd13dd139..6102ff252923aa9b967cdb0cfa28aeb79d02489a 100644 (file)
@@ -667,10 +667,11 @@ const QuickSettingsLayout = GObject.registerClass({
         return [this.nColumns * childMin + spacing, this.nColumns * childNat + spacing];
     }
 
-    vfunc_get_preferred_height(container, _forWidth) {
+    vfunc_get_preferred_height(container, forWidth) {
         const rows = this._getRows(container);
 
-        let [minHeight, natHeight] = this._overlay.get_preferred_height(-1);
+        let [minHeight, natHeight] =
+            this._overlay.get_preferred_height(forWidth);
 
         const spacing = (rows.length - 1) * this.row_spacing;
         minHeight += spacing;
@@ -688,12 +689,13 @@ const QuickSettingsLayout = GObject.registerClass({
     vfunc_allocate(container, box) {
         const rows = this._getRows(container);
 
-        const [, overlayHeight] = this._overlay.get_preferred_height(-1);
+        const [, overlayHeight] =
+            this._overlay.get_preferred_height(box.get_width());
 
         const availWidth = box.get_width() - (this.nColumns - 1) * this.column_spacing;
         const childWidth = Math.floor(availWidth / this.nColumns);
 
-        this._overlay.allocate_available_size(0, 0, box.get_width(), box.get_height());
+        this._overlay.allocate_available_size(0, 0, box.get_width(), overlayHeight);
 
         const isRtl = container.text_direction === Clutter.TextDirection.RTL;